package chapter05.Example04;

public class Example04 {
    public static void main(String[] args) {
        String s="itcast";
        System.out.println("将it替换为cn.it的结果:"+s.replace("it","cn,it"));
        String sl="   i t c a s t    ";
        System.out.println("去掉字符串两端空格后的结果:"+sl.trim());
        System.out.println("去掉字符串所有空格后的结果:"+sl.replace(" ",""));
    }
}
